﻿#pragma once

#include "MirImageControl.h"
#include "MirLabel.h"
#include "../../Shared/Data/ItemData.h"
#include "MirButton.h"
#include "MirAnimatedControl.h"
#include <string>
#include <any>

//C# TO C++ CONVERTER NOTE: Forward class declarations:
namespace Client::MirControls { class GameShopViewer; }

using namespace Client::MirGraphics;
using namespace Client::MirNetwork;
using namespace Client::MirObjects;
using namespace Client::MirScenes;
using namespace Client::MirSounds;
using namespace Client::MirScenes::Dialogs;
namespace C = ClientPackets;

namespace Client::MirControls
{
    class GameShopCell final : public MirImageControl
    {
    public:
        MirLabel *nameLabel, *typeLabel, *goldLabel, *gpLabel, *stockLabel, *StockLabel, *countLabel;
        GameShopItem *Item;
        UserItem *ShowItem;
    private:
        Rectangle *ItemDisplayArea;
    public:
        MirButton *BuyItem, *PreviewItem;
        MirImageControl *ViewerBackground;
        unsigned char Quantity = 1;
        MirButton *quantityUp, *quantityDown;
        MirLabel *quantity;
        GameShopViewer *Viewer;

        virtual ~GameShopCell()
        {
            delete nameLabel;
            delete typeLabel;
            delete goldLabel;
            delete gpLabel;
            delete stockLabel;
            delete StockLabel;
            delete countLabel;
            delete Item;
            delete ShowItem;
            delete ItemDisplayArea;
            delete BuyItem;
            delete PreviewItem;
            delete ViewerBackground;
            delete quantityUp;
            delete quantityDown;
            delete quantity;
            delete Viewer;
        }

        GameShopCell();

        void BuyProduct();

        void OnMouseMove(MouseEventArgs *e) override;

        void UpdateText();

    protected:
        void DrawControl() override;

        void Dispose(bool disposing) override;

    };

    class GameShopViewer final : public MirImageControl
    {

    public:
        MirAnimatedControl *PreviewImage, *WeaponImage, *WeaponImage2, *MountImage;

        int StartIndex = 0;
        int Direction = 6;
        GameShopItem *ViewerItem;

        MirButton *RightDirection, *LeftDirection, *CloseButton;


        virtual ~GameShopViewer()
        {
            delete PreviewImage;
            delete WeaponImage;
            delete WeaponImage2;
            delete MountImage;
            delete ViewerItem;
            delete RightDirection;
            delete LeftDirection;
            delete CloseButton;
        }

        GameShopViewer();

        void UpdateViewer();

    private:
        void GameShopViewer_BeforeDraw(std::any sender, EventArgs *e);

        void DrawMount();

        void DrawWeapon();

        void DrawArmour();

        void DrawTransform();

        void DrawMask();

    };
}
